package xyz.bali16.module.activeuser.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.bali16.application.core.enums.ApiEnum;
import xyz.bali16.application.core.model.Result;
import xyz.bali16.module.activeuser.entity.Statistics;
import xyz.bali16.module.activeuser.service.StatisticsService;

import static xyz.bali16.application.core.model.Result.success;

/**
 * @author bali2 on 9/3/2023.
 * @version 1.0
 */
@RestController
@RequestMapping(BaseController.API+"statistics")
@Api(tags = "后台统计数据接口")
@AllArgsConstructor

public class StatisticsController extends BaseController{
    @Autowired
    StatisticsService statisticsService;

    @GetMapping
    @ApiOperation(value = "查询后台数据")
    //@PreAuthorize("@auth.permission('plugin:statistics:query')")
    public Result<Statistics> getStatistics() {
        return success(ApiEnum.GET_SUCCESS,statisticsService.indexData());
    }

}
